//
//  NSObject+PK.swift
//  Panku
//
//  Created by mac on 2017/2/17.
//  Copyright © 2017年 Monster. All rights reserved.
//

import Foundation
extension NSObject {
    
    //通过类名获取类本身
    class func stringClassFromString(_ className: String) -> AnyClass! {
        
        /// get namespace
        let namespace = Bundle.main.infoDictionary!["CFBundleExecutable"] as! String;
        
        /// get 'anyClass' with classname and namespace
        let cls: AnyClass = NSClassFromString("\(namespace).\(className)")!;
        
        // return AnyClass!
        return cls;
    }
    
}
